import java.util.concurrent.atomic.AtomicLong;

public class Generator {
    private final AtomicLong atomicLong = new AtomicLong(0);

    public long getNextId() {
        return atomicLong.incrementAndGet();
    }

    void getMultipleIds() {
        new Thread(() -> {
            for (int i = 0; i < 20; i++) {
                long sysId = this.getNextId();
                System.out.println(sysId);
            }
        }).start();
    }
}
